# $Id: PKGBUILD 82755 2013-01-23 21:01:47Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Kessia 'even' Pinheiro <kessiapinheiro at gmail.com>
# Contributor: Sorin Ionescu <sorin.ionescu@gmail.com>

pkgname=ufw
pkgver=0.33
pkgrel=2
pkgdesc="Uncomplicated and easy to use CLI tool for managing a netfilter firewall"
arch=('any')
url="https://launchpad.net/ufw"
license=('GPL3')
depends=('iptables' 'python2')
backup=('etc/ufw/before.rules'
        'etc/ufw/before6.rules'
        'etc/ufw/after.rules'
        'etc/ufw/after6.rules'
        'etc/ufw/ufw.conf'
        'etc/ufw/user.rules'
        'etc/ufw/sysctl.conf'
        'etc/default/ufw'
        'usr/lib/ufw/user.rules'
        'usr/lib/ufw/user6.rules')
source=(http://launchpad.net/$pkgname/$pkgver/$pkgver/+download/${pkgname}-${pkgver}.tar.gz
        service)
sha256sums=('5f85a8084ad3539b547bec097286948233188c971f498890316dec170bdd1da8'
            'fdface6f4690e4748fbbd5661c02e1967a8750fdb23581d35516174017a3fe39')

package() {
  cd $srcdir/$pkgname-$pkgver
  
  # FS#28769 - move from /lib to /usr/lib
  sed -e 's|/lib|/usr/lib|' -i setup.py

  python2 setup.py install --root=$pkgdir

  install -Dm644 $srcdir/service $pkgdir/usr/lib/systemd/system/ufw.service

  install -Dm755 $pkgdir/usr/sbin/$pkgname $pkgdir/usr/bin/$pkgname
  rm -rf $pkgdir/usr/sbin

  chmod 644 $pkgdir/etc/ufw/*.rules $pkgdir/usr/lib/ufw/*.rules
}
